/***
 * Autoload Langage
 */

Ext.define('storedefextract', {
	 extend: 'Ext.util.Observable',
	 constructor: function(){

            this.callParent(arguments);
            this.addEvents({
                'initStructurTerminated' : true,
                'initDataTerminated' : true,
                'initColumnTerminated' : true,
                'initAllTerminated' : true,
                
            });
           
       },
	getData:{},
	getStructur:{},
	getColumnGrid:{},
	LoadAll:function(){
	
    	var me=this;
    	Ext.Ajax.request({
		    url: 'pilotage/projectbord/loaddataboard',
		    success: function(response1){
		    	 me.fireEvent('initDataTerminated', 'true', response1.responseText);
		    	 Ext.Ajax.request({
		 		    url: 'pilotage/projectbord/dycolumnboard',
		 		    success: function(response){
		 		    	
		 		    	 me.fireEvent('initColumnTerminated', 'true', response.responseText);
		 		    },
		 	        failure: function(response, opts) {
		 	        	 me.fireEvent('initColumnTerminated','false','Erreur');
		                
		           }
		           
		 		});
		    },
	        failure: function(response, opts) {
	        	 me.fireEvent('initDataTerminated','false','Erreur');
               
          }
          
		});
		
	},
    LoadStoreStructure:function(){
    	var globalresponse="";
    	var me=this;
    	Ext.Ajax.request({
		    url: 'pilotage/projectbord/jsonstructerdataboard',
		    success: function(response){
		    	globalresponse=response.responseText;
		    	 me.fireEvent('initStructurTerminated', 'true', response.responseText);
		    },
	        failure: function(response, opts) {
            
               me.fireEvent('initStructurTerminated','false','Erreur');
            }
		});
		//translateTab=tmp;
		this.getStructur=globalresponse;
    },
     LoadData:function(){
    	var globalresponse="";
    	var me=this;
    	Ext.Ajax.request({
		    url: 'pilotage/projectbord/loaddataboard',
		    success: function(response){
		    	globalresponse=response.responseText;
		    	 me.fireEvent('initDataTerminated', 'true', response.responseText);
		    },
	        failure: function(response, opts) {
	        	 me.fireEvent('initDataTerminated','false','Erreur');
               
          }
          
		});
	
		this.getData=globalresponse;
		
    },
     LoadColumnTable:function(){
    	var globalresponse="";
    	var me=this;
    	Ext.Ajax.request({
		    url: 'pilotage/projectbord/dycolumnboard',
		    success: function(response){
		    	globalresponse=response.responseText;
		    	 me.fireEvent('initColumnTerminated', 'true', response.responseText);
		    },
	        failure: function(response, opts) {
	        	 me.fireEvent('initColumnTerminated','false','Erreur');
               
          }
          
		});
	
		this.getColumnGrid=globalresponse;
		
    }
});



